package com.neulogistics.contrib.procuredcenter.api.application.converter;

import com.neulogistics.contrib.procuredcenter.api.application.viewmodel.GoodsListViewModel;
import com.neulogistics.contrib.procuredcenter.api.application.viewmodel.TreeNodeViewModel;
import com.neulogistics.contrib.procuredcenter.infrastructure.persistence.orm.po.GoodsListPO;
import com.neulogistics.contrib.procuredcenter.infrastructure.persistence.orm.po.GoodsSetPO;
import org.springframework.beans.BeanUtils;

public class TreeConverter {
    public static TreeNodeViewModel ListPOToVM(GoodsListPO goodsListPO){
        if (goodsListPO == null)
            return null;

        TreeNodeViewModel treeNodeViewModel = new TreeNodeViewModel();
        treeNodeViewModel.setId(goodsListPO.getListId());
        treeNodeViewModel.setName(goodsListPO.getListName());

        return treeNodeViewModel;
    }

    public static TreeNodeViewModel SetPOToVM(GoodsSetPO goodsSetPO){
        if (goodsSetPO == null)
            return null;

        TreeNodeViewModel treeNodeViewModel = new TreeNodeViewModel();
        treeNodeViewModel.setId(goodsSetPO.getSetId());
        treeNodeViewModel.setName(goodsSetPO.getSetName());

        return treeNodeViewModel;
    }
}
